<template>
  <div style="text-align: center;">

    <van-form :model="addForm">
      <!-- <van-divider :style="{ color: '#1989fa', borderColor: '#1989fa', padding: '0 16px' }">
        基本资料填写
      </van-divider> -->
      <div>
        <van-cell-group inset>
          <van-row>
            <van-col span=16> <van-field name="海典门店编号"
                         label="海典门店编号"
                         placeholder="请输入"
                         type="number"
                         v-model="addForm.busno"
                         :rules="[{ required: true, message: '请填写门店号' }]" /></van-col>
            <van-col span=8> <van-button round
                          block
                          type="primary"
                          @click="qureyByBusno">
                查询
              </van-button></van-col>
          </van-row>

          <van-field name="海典门店名称"
                     label="海典门店名称"
                     v-model="addForm.orgname"
                     :rules="[{ required: true, message: '海典门店名称' }]"
                     disabled />

          <van-row>
            <van-col span=16> <van-field name="手机"
                         label="手机"
                         placeholder="请输入"
                         type="number"
                         v-model="addForm.mobile"
                         :rules="[{ required: true, message: '手机' }]" /></van-col>
            <van-col span=8> <van-button round
                          block
                          type="primary"
                          @click="sendSMSCode">
                发送验证码
              </van-button></van-col>
          </van-row>
          <van-field name="验证码"
                     label="验证码"
                     placeholder="请输入"
                     v-model="addForm.checkcode"
                     type="number"
                     :rules="[{ required: true, message: '验证码' }]" />

          <van-field name="姓名"
                     label="姓名"
                     v-model="addForm.empName"
                     :rules="[{ required: true, message: '请填写姓名' }]"
                     disabled />

          <!-- <van-field name="手机号码"
                     label="手机号码"
                     placeholder="请输入"
                     v-model="addForm.mobile"
                     :rules="[{ required: true, message: '请填写手机号码' }]" />

          <van-field name="常用语言"
                     label="常用语言"
                     placeholder="请输入"
                     @focus="languageFocus"
                     v-model="addForm.languageStatus"
                     :rules="[{ required: true, message: '请填写常用语言' }]" />
          <van-field name="常用交通工具"
                     label="常用交通工具"
                     placeholder="请输入"
                     @focus="vehicleFocus"
                     v-model="addForm.vehicle"
                     :rules="[{ required: true, message: '请填写常用交通工具' }]" />
          <van-field name="专业技术职称类型"
                     label="专业技术职称类型"
                     placeholder="请输入"
                     @focus="technicalTitleFocus"
                     v-model="addForm.technicalTitle"
                     :rules="[{ required: true, message: '请填写专业技术职称类型' }]" />

          <van-field name="执业资格证类型"
                     label="执业资格证类型"
                     placeholder="请输入"
                     @focus="quacardTypeFocus"
                     v-model="addForm.quacardType"
                     :rules="[{ required: true, message: '请填写执业资格证类型' }]" />
          <van-field name="民族"
                     label="民族"
                     placeholder="请输入"
                     @focus="nationFocus"
                     v-model="addForm.nation"
                     :rules="[{ required: true, message: '请填写民族' }]" />

          <van-field name="身高"
                     label="身高（cm）"
                     placeholder="请输入"
                     v-model="addForm.height"
                     @focus="closeKeyboard"
                     @touchstart.native.stop="heightShow = true"
                     :rules="[{ required: true, message: '请填写身高' }]" />

          <van-field name="体重"
                     label="体重（kg）"
                     placeholder="请输入"
                     v-model="addForm.weight"
                     @focus="closeKeyboard"
                     @touchstart.native.stop="weightShow = true"
                     :rules="[{ required: true, message: '请填写体重' }]" />
          <van-field name="主要性格"
                     label="主要性格"
                     placeholder="请输入"
                     v-model="addForm.characters"
                     @focus="charactersFocus"
                     :rules="[{ required: true, message: '请填写主要性格' }]" />

          <van-field name="擅长文娱"
                     label="擅长文娱"
                     placeholder="请输入"
                     v-model="addForm.hobby"
                     @focus="hobbyFocus"
                     :rules="[{ required: true, message: '请填写擅长文娱' }]" />

          <van-field name="政治面貌"
                     label="政治面貌"
                     placeholder="请输入"
                     v-model="addForm.politicalFace"
                     @focus="politicalFaceFocus"
                     :rules="[{ required: true, message: '请填写政治面貌' }]" />
          <van-field name="籍贯"
                     label="籍贯"
                     placeholder="请输入XX省XX市"
                     v-model="addForm.nativePlace"
                     :rules="[{ required: true, message: '请填写籍贯' }]" />
          <van-field name="户籍所在地"
                     label="户籍所在地"
                     placeholder="请输入XX省XX市"
                     v-model="addForm.residenceAddr"
                     :rules="[{ required: true, message: '请填写户籍所在地' }]" />

          <van-field name="户别"
                     label="户别"
                     placeholder="请输入"
                     v-model="addForm.houseType"
                     @focus="houseTypeFocus"
                     :rules="[{ required: true, message: '请填写户别' }]" />

          <van-field name="常住家庭区域"
                     label="常住家庭区域"
                     placeholder="请输入XX省XX市XX区"
                     v-model="addForm.houseArea"
                     :rules="[{ required: true, message: '请填写常住家庭区域' }]" />
          <van-field name="常住家庭详细地址"
                     label="常住家庭详细地址"
                     placeholder="请输入"
                     v-model="addForm.houseAddr"
                     :rules="[{ required: true, message: '请填写常住家庭详细地址' }]" />
          <van-field name="现居住区域"
                     label="现居住区域"
                     placeholder="请输入"
                     v-model="addForm.residencePlace"
                     :rules="[{ required: true, message: '请填写现居住区域' }]" />

          <van-field name="紧急联系人手机号码"
                     label="紧急联系人手机号码"
                     placeholder="请输入"
                     v-model="addForm.tel"
                     :rules="[{ required: true, message: '请填写紧急联系人手机号码' }]" />

          <van-field name="婚姻状况"
                     label="婚姻状况"
                     placeholder="请输入"
                     v-model="addForm.marriageStatus"
                     @focus="marriageStatusFocus"
                     :rules="[{ required: true, message: '请填写婚姻状况' }]" />
          <van-field name="已婚（子女数）"
                     label="已婚（子女数）"
                     placeholder="请输入"
                     v-model="addForm.childrens"
                     @focus="closeKeyboard"
                     @touchstart.native.stop="childrensShow = true"
                     :rules="[{ required: true, message: '请填写已婚（子女数）' }]" />
          <van-field name="未婚（兄弟姐妹数）"
                     label="未婚（兄弟姐妹数）"
                     placeholder="请输入"
                     @focus="closeKeyboard"
                     v-model="addForm.members"
                     @touchstart.native.stop="membersShow = true"
                     :rules="[{ required: true, message: '请填写未婚（兄弟姐妹数）' }]" />

          <van-field name="全日制学历类型"
                     label="全日制学历类型"
                     placeholder="请输入"
                     v-model="addForm.educationType1"
                     @focus="educationType1Focus"
                     :rules="[{ required: true, message: '请填写全日制学历类型' }]" />

          <van-field name="全日制学历专业"
                     label="全日制学历专业"
                     placeholder="请输入"
                     v-model="addForm.major1"
                     :rules="[{ required: true, message: '请填写全日制学历专业' }]" />
          <van-field name="最高学历类型"
                     label="最高学历类型"
                     placeholder="请输入"
                     v-model="addForm.educationType2"
                     @focus="educationType2Focus"
                     :rules="[{ required: true, message: '请填写最高学历类型' }]" />
          <van-field name="最高学历专业"
                     label="最高学历专业"
                     placeholder="请输入"
                     v-model="addForm.major2"
                     :rules="[{ required: true, message: '请填写最高学历专业' }]" /> -->
        </van-cell-group>
      </div>

      <!-- <van-divider :style="{ color: '#1989fa', borderColor: '#1989fa', padding: '0 16px' }">
        学习经历
      </van-divider>
      <div class="moreRulesIn"
           v-for="(item, index) in addForm.h2LearnhistoryList"
           :key="item.key">

        <div style="margin-top:20px">
          <div style="text-align:right;margin-right:10px">
            <van-icon @click="deleteLearnhistory(item, index)"
                      name="delete-o"
                      size="30px" />
          </div>

          <div style="left:10px">

          </div>
          <van-cell-group inset>
            <van-field name="学校名称"
                       label="学校名称"
                       placeholder="请输入"
                       v-model="item.schoolName"
                       :rules="[{ required: true, message: '请填写学校名称' }]" />
            <van-field v-model="item.startdate"
                       name="开始时间"
                       label="开始时间"
                       placeholder="请输入"
                       @focus="learnstartFocus(index)"
                       :rules="[{ required: true, message: '请填写开始时间' }]" />
            <van-field v-model="item.enddate"
                       name="结束时间"
                       label="结束时间"
                       placeholder="请输入"
                       @focus="learnendFocus(index)"
                       :rules="[{ required: true, message: '请填写结束时间' }]" />
            <van-field v-model="item.major"
                       name="专业"
                       label="专业"
                       placeholder="请输入"
                       :rules="[{ required: true, message: '请填写专业' }]" />
            <van-field v-model="item.edu"
                       name="学历"
                       label="学历"
                       placeholder="请输入"
                       @focus="eduFocus"
                       :rules="[{ required: true, message: '请填写学历' }]" />
            <van-field v-model="item.certificate"
                       name="证书编号"
                       label="证书编号"
                       placeholder="请输入"
                       :rules="[{ required: true, message: '请填写证书编号' }]" />
          </van-cell-group>
        </div>

      </div>
      <van-row style="margin-top:20px">
        <van-col span="6">
          <van-icon name="add-o"
                    @click="addLearnhistory"
                    size="30px" />
        </van-col>
      </van-row>

      <van-divider :style="{ color: '#1989fa', borderColor: '#1989fa', padding: '0 16px' }">
        工作经历
      </van-divider>
      <div class="moreRulesIn"
           v-for="(item, index) in addForm.h2WorkhistoryList"
           :key="item.key">

        <div style="margin-top:20px">
          <div style="text-align:right;margin-right:10px">
            <van-icon @click="deleteWorkhistory(item, index)"
                      name="delete-o"
                      size="30px" />
          </div>

          <div style="left:10px">

          </div>
          <van-cell-group inset>
            <van-field name="单位名称"
                       label="单位名称"
                       placeholder="请输入"
                       v-model="item.companyname"
                       :rules="[{ required: true, message: '请填写单位名称' }]" />
            <van-field v-model="item.startdate"
                       name="开始时间"
                       label="开始时间"
                       placeholder="请输入"
                       @focus="workstartFocus(index)"
                       :rules="[{ required: true, message: '请填写开始时间' }]" />
            <van-field v-model="item.enddate"
                       name="结束时间"
                       label="结束时间"
                       placeholder="请输入"
                       @focus="workendFocus(index)"
                       :rules="[{ required: true, message: '请填写结束时间' }]" />
            <van-field v-model="item.jobtitle"
                       name="职务"
                       label="职务"
                       placeholder="请输入"
                       :rules="[{ required: true, message: '请填写职务' }]" />
          </van-cell-group>
        </div>
      </div>
      <van-row style="margin-top:20px">
        <van-col span="6">
          <van-icon name="add-o"
                    @click="addWorkhistory"
                    size="30px" />
        </van-col>
      </van-row>

      <div style="margin-bottom:40px"
           v-show="addForm.franchise">
        <van-divider :style="{ color: '#1989fa', borderColor: '#1989fa', padding: '0 16px' }">
          加盟店
        </van-divider>

        <div style="left:10px">

        </div>
        <van-cell-group inset>
          <p align='left'
             style="color:#FFA500">PS：以下是加盟店员工才需要勾选填写</p>
          <van-checkbox v-model="addForm.franchise"
                        @click="franchiseChoice()"
                        style="display:none">加盟店员工</van-checkbox>
          <div>
            <van-field name="入职门店"
                       label="入职门店"
                       placeholder="请输入营业执照上的全称"
                       v-model="addForm.inductionBusname" />

            <van-field v-model="addForm.inductionDate"
                       name="入职日期"
                       label="入职日期"
                       placeholder="请输入"
                       @focus="inductionDateFocus(index)" />

            <van-field name="员工类别"
                       label="员工类别"
                       placeholder="请输入"
                       v-model="addForm.empType"
                       @focus="empTypeFocus" />

            <van-field name="入职岗位"
                       label="入职岗位"
                       placeholder="请输入"
                       v-model="addForm.inductionPost"
                       @focus="inductionPostFocus" />

            <van-cell-group inset
                            style="margin-top:5px">
              <p align='left'
                 style="color:#696969">备案岗位</p>
              <van-checkbox-group v-model="addForm.filingPost1"
                                  @change="fillPostClick"
                                  direction="vertical">
                <van-checkbox name="企业负责人"
                              shape="square">企业负责人</van-checkbox><br />
                <van-checkbox name="店长"
                              shape="square">店长</van-checkbox><br />
                <van-checkbox name="质量负责人"
                              shape="square">质量负责人</van-checkbox><br />
                <van-checkbox name="处方审核员"
                              shape="square">处方审核员</van-checkbox><br />
                <van-checkbox name="质管员"
                              shape="square">质管员</van-checkbox><br />
                <van-checkbox name="验收员"
                              shape="square">验收员</van-checkbox><br />
                <van-checkbox name="采购员"
                              shape="square">采购员</van-checkbox><br />
                <van-checkbox name="中药调剂员"
                              shape="square">中药调剂员</van-checkbox><br />
                <van-checkbox name="食品安全管理员"
                              shape="square">食品安全管理员</van-checkbox><br />
                <van-checkbox name="营业员"
                              shape="square">营业员</van-checkbox>
              </van-checkbox-group>

            </van-cell-group>
          </div>

        </van-cell-group>
      </div> -->

      <div style="margin: 16px;">
        <van-button round
                    block
                    type="primary"
                    @click="submit">
          提交
        </van-button>
      </div>
    </van-form>

    <div>
      <van-popup v-model="learnstartShow"
                 position="bottom">
        <van-datetime-picker v-model="currentDate"
                             style="weight:100px"
                             type="date"
                             :min-date="minDate"
                             :max-date="maxDate"
                             @change="learnstartChangeFn()"
                             @confirm="learnstartConfirmFn()"
                             @cancel="learnstartCancelFn()" />
      </van-popup>
    </div>

    <div>
      <van-popup v-model="learnendShow"
                 position="bottom">
        <van-datetime-picker v-model="currentDate"
                             style="weight:100px"
                             type="date"
                             :min-date="minDate"
                             :max-date="maxDate"
                             @change="learnendChangeFn()"
                             @confirm="learnendConfirmFn()"
                             @cancel="learnendCancelFn()" />
      </van-popup>
    </div>

    <div>
      <van-popup v-model="workstartShow"
                 position="bottom">
        <van-datetime-picker v-model="currentDate"
                             style="weight:100px"
                             type="date"
                             :min-date="minDate"
                             :max-date="maxDate"
                             @change="workstartChangeFn()"
                             @confirm="workstartConfirmFn()"
                             @cancel="workstartCancelFn()" />
      </van-popup>
    </div>

    <div>
      <van-popup v-model="inductionDateShow"
                 position="bottom">
        <van-datetime-picker v-model="currentDate"
                             style="weight:100px"
                             type="date"
                             :min-date="minDate"
                             :max-date="maxDate"
                             @change="inductionDateChangeFn()"
                             @confirm="inductionDateConfirmFn()"
                             @cancel="inductionDateCancelFn()" />
      </van-popup>
    </div>

    <!-- 生日 -->
    <div>
      <van-popup v-model="birthdayShow"
                 position="bottom">
        <van-datetime-picker v-model="currentDate"
                             style="weight:100px"
                             type="date"
                             :min-date="minDate"
                             :max-date="maxDate"
                             @change="birthdayChangeFn()"
                             @confirm="birthdayConfirmFn()"
                             @cancel="birthdayCancelFn()" />
      </van-popup>
    </div>

    <!-- 常用工具 -->
    <div>
      <van-popup v-model="vehicleShow"
                 position="bottom">
        <van-picker :columns="vehicleColumns"
                    @confirm="vehicleConfirmFn"
                    @cancel="vehicleCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <!--  常用语言-->
    <div>
      <van-popup v-model="languageShow"
                 position="bottom">
        <van-picker :columns="languageColumns"
                    @confirm="languageConfirmFn"
                    @cancel="languageCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <!--  专业技术职称类型-->
    <div>
      <van-popup v-model="technicalTitleShow"
                 position="bottom">
        <van-picker :columns="technicalTitleColumns"
                    @confirm="technicalTitleConfirmFn"
                    @cancel="technicalTitleCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <!--  执业资格证类型-->
    <div>
      <van-popup v-model="quacardTypeShow"
                 position="bottom">
        <van-picker :columns="quacardTypeColumns"
                    @confirm="quacardTypeConfirmFn"
                    @cancel="quacardTypeCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <!-- 年龄 -->
    <div>
      <van-number-keyboard :show="ageShow"
                           theme="custom"
                           extra-key="."
                           close-button-text="完成"
                           @blur="ageShow = false"
                           @input="ageInput"
                           @delete="ageDelete" />
    </div>

    <!-- 民族 -->
    <div>
      <van-popup v-model="nationShow"
                 position="bottom">
        <van-picker :columns="nationColumns"
                    @confirm="nationConfirmFn"
                    @cancel="nationCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <!--  性别-->
    <div>
      <van-popup v-model="sexShow"
                 position="bottom">
        <van-picker :columns="sexColumns"
                    @confirm="sexConfirmFn"
                    @cancel="sexCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <div>
      <van-number-keyboard :show="heightShow"
                           theme="custom"
                           extra-key="."
                           close-button-text="完成"
                           @blur="heightShow = false"
                           @input="heightInput"
                           @delete="heightDelete" />
    </div>

    <div>
      <van-number-keyboard :show="weightShow"
                           theme="custom"
                           extra-key="."
                           close-button-text="完成"
                           @blur="weightShow = false"
                           @input="weightInput"
                           @delete="weightDelete" />
    </div>

    <div>
      <van-popup v-model="charactersShow"
                 position="bottom">
        <van-picker :columns="charactersColumns"
                    @confirm="charactersConfirmFn"
                    @cancel="charactersCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <div>
      <van-popup v-model="hobbyShow"
                 position="bottom">
        <van-picker :columns="hobbyColumns"
                    @confirm="hobbyConfirmFn"
                    @cancel="hobbyCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <div>
      <van-popup v-model="politicalFaceShow"
                 position="bottom">
        <van-picker :columns="politicalFaceColumns"
                    @confirm="politicalFaceConfirmFn"
                    @cancel="politicalFaceCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <div>
      <van-popup v-model="empTypeShow"
                 position="bottom">
        <van-picker :columns="empTypeColumns"
                    @confirm="empTypeConfirmFn"
                    @cancel="empTypeCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <div>
      <van-popup v-model="inductionPostShow"
                 position="bottom">
        <van-picker :columns="inductionPostColumns"
                    @confirm="inductionPostConfirmFn"
                    @cancel="inductionPostCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <div>
      <van-popup v-model="houseTypeShow"
                 position="bottom">
        <van-picker :columns="houseTypeColumns"
                    @confirm="houseTypeConfirmFn"
                    @cancel="houseTypeCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <div>
      <van-popup v-model="marriageStatusShow"
                 position="bottom">
        <van-picker :columns="marriageStatusColumns"
                    @confirm="marriageStatusConfirmFn"
                    @cancel="marriageStatusCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <div>
      <van-number-keyboard :show="childrensShow"
                           theme="custom"
                           extra-key="."
                           close-button-text="完成"
                           @blur="childrensShow = false"
                           @input="childrensInput"
                           @delete="childrensDelete" />
    </div>

    <div>
      <van-number-keyboard :show="membersShow"
                           theme="custom"
                           extra-key="."
                           close-button-text="完成"
                           @blur="membersShow = false"
                           @input="membersInput"
                           @delete="membersDelete" />
    </div>

    <div>
      <van-popup v-model="educationType1Show"
                 position="bottom">
        <van-picker :columns="educationType1Columns"
                    @confirm="educationType1ConfirmFn"
                    @cancel="educationType1CancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <div>
      <van-popup v-model="educationType2Show"
                 position="bottom">
        <van-picker :columns="educationType2Columns"
                    @confirm="educationType2ConfirmFn"
                    @cancel="educationType2CancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <div>
      <van-popup v-model="eduShow"
                 position="bottom">
        <van-picker :columns="eduColumns"
                    @confirm="eduConfirmFn"
                    @cancel="eduCancelFn"
                    show-toolbar />
      </van-popup>
    </div>

    <div>
      <van-popup v-model="workendShow"
                 position="bottom">
        <van-datetime-picker v-model="currentDate"
                             style="weight:100px"
                             type="date"
                             :min-date="minDate"
                             :max-date="maxDate"
                             @change="workendChangeFn()"
                             @confirm="workendConfirmFn()"
                             @cancel="workendCancelFn()" />
      </van-popup>
    </div>

  </div>

</template>

<script>
import http from '../../api/http.js'

export default {

  created () {

  },

  mounted () {

  },

  data () {
    return {
      vehicleColumns: ['小汽车', '摩托车', '电瓶车', '公交', '步行'],
      languageColumns: ['粤语', '普通话', '以上两者均可'],
      technicalTitleColumns: ['无', '药士', '中药士', '初级药师', '初级中药师', '中级药师', '中级中药师'],
      quacardTypeColumns: ['无', '执业药师', '执业中药师', '执业中西药师', '执业医师'],
      nationColumns: ['汉族', '蒙古族', '回族', '藏族', '维吾尔族', '苗族', '彝族', '壮族', '布依族', '朝鲜族', '满族', '侗族', '瑶族', '白族', '土家族', '哈尼族', '哈萨克族', '傣族', '黎族', '傈僳族 ', '佤族', '畲族', '高山族', '拉祜族', '水族', '东乡族', '纳西族', '景颇族', '柯尔克孜族', '土族', '达斡尔族', '仫佬族', '羌族', '布朗族', '撒拉族', '毛难族', '仡佬族', '锡伯族', '阿昌族', '普米族', '塔吉克族', '怒族', '乌孜别克族', '俄罗斯族', '鄂温克族', '崩龙族', '保安族', '裕固族', '京族', '塔塔尔族', '独龙族', '鄂伦春族', '赫哲族', '门巴族', '珞巴族', '基诺族'],
      sexColumns: ['男', '女'],
      charactersColumns: ['活泼开朗', '沉着稳重', '独立自信', '懦弱怕事', '随波逐流'],
      hobbyColumns: ['各类球体运动', '冒险、刺激运动', '悠闲爬山', '阅读、听歌', '唱歌、跳舞', '其它'],
      politicalFaceColumns: ['中共党员', '共青团员', '群众', '其它'],
      empTypeColumns: ['合同工', '试用工', '实习生', '退休返聘', '退休留用'],
      inductionPostColumns: ['店长', '营业员'],
      houseTypeColumns: ['本地农业户口', '本地非农业户口', '外地农业户口', '外地非农业户口'],
      marriageStatusColumns: ['已婚', '未婚', '离异'],
      educationType1Columns: ['初中', '高中', '中专', '大专', '本科', '研究生', '硕士', '博士初中', '高中', '中专', '大专', '本科', '研究生', '硕士', '博士'],
      educationType2Columns: ['初中', '高中', '中专', '大专', '本科', '研究生', '硕士', '博士初中', '高中', '中专', '大专', '本科', '研究生', '硕士', '博士'],
      eduColumns: ['初中', '高中', '中专', '大专', '本科', '研究生', '硕士', '博士初中', '高中', '中专', '大专', '本科', '研究生', '硕士', '博士'],
      minDate: new Date(1950, 0, 1),
      maxDate: new Date(2080, 12, 1),
      currentDate: new Date(),
      changeDate: new Date(),
      birthdayShow: false, // 用来显示弹出层
      vehicleShow: false,
      languageShow: false,
      technicalTitleShow: false,
      quacardTypeShow: false,
      ageShow: false,
      nationShow: false,
      sexShow: false,
      heightShow: false,
      weightShow: false,
      charactersShow: false,
      hobbyShow: false,
      politicalFaceShow: false,
      empTypeShow: false,
      inductionPostShow: false,
      houseTypeShow: false,
      marriageStatusShow: false,
      childrensShow: false,
      membersShow: false,
      educationType1Show: false,
      educationType2Show: false,
      learnstartShow: false,
      workendShow: false,
      learnendShow: false,
      learnKey: 0,
      workKey: 0,
      eduShow: false,
      workstartShow: false,
      inductionDateShow: false,
      addForm: {
        idNo: "",
        openId: "",
        h2Flag: "",
        empName: "",
        busno: "",
        checkcode: "",
        mobile1: "",
        orgname: "",
        uploadDate: "",
        idCard: "",
        mobile: "",
        languageStatus: "",
        vehicle: "",
        technicalTitle: "",
        quacardType: "",
        birthday: "",
        inductionDate: "",
        age: "",
        nation: "",
        sex: "",
        height: "",
        weight: "",
        characters: "",
        hobby: "",
        politicalFace: "",
        empType: "",
        inductionPost: "",
        nativePlace: "",
        residenceAddr: "",
        houseType: "",
        houseArea: "",
        houseAddr: "",
        residencePlace: "",
        tel: "",
        marriageStatus: "",
        childrens: "",
        members: "",
        educationType1: "",
        major1: "",
        educationType2: "",
        major2: "",
        inductionBusname: "",
        franchise: false,
        filingPost1: [],
        filingPost: "",
        h2LearnhistoryList: [
          {
            schoolName: "",
            startdate: "",
            enddate: "",
            major: "",
            edu: "",
            certificate: ""
          }
        ],
        h2WorkhistoryList: [
          {
            companyname: "",
            startdate: "",
            enddate: "",
            jobtitle: ""
          }
        ],
      },
    };
  },


  methods: {
    franchiseChoice () {

    },

    closeKeyboard () {
      document.activeElement.blur()
    }
    ,
    workendFocus (key) {
      document.activeElement.blur()
      this.learnKey = key
      this.workendShow = true
    },
    workendChangeFn () { // 值变化是触发
      this.changeDate = this.currentDate // Tue Sep 08 2020 00:00:00 GMT+0800 (中国标准时间)
    },
    workendConfirmFn () { // 确定按钮
      console.log(this.workKey)
      console.log(this.timeFormat(this.currentDate))
      this.addForm.h2WorkhistoryList[this.workKey].enddate = this.timeFormat(this.currentDate);
      this.workendShow = false;
    },
    workendCancelFn () {
      console.log('关')
      this.workendShow = false;
    },


    workstartFocus (key) {
      document.activeElement.blur()
      this.workKey = key
      this.workstartShow = true

    },
    workstartChangeFn () { // 值变化是触发
      this.changeDate = this.currentDate // Tue Sep 08 2020 00:00:00 GMT+0800 (中国标准时间)
    },
    workstartConfirmFn () { // 确定按钮
      this.addForm.h2WorkhistoryList[this.workKey].startdate = this.timeFormat(this.currentDate);
      this.workstartShow = false;
    },
    workstartCancelFn () {
      console.log('关')
      this.workstartShow = false;
    },


    eduFocus () {
      document.activeElement.blur()
      this.eduShow = true
    },
    eduConfirmFn (value, index) {
      this.addForm.h2LearnhistoryList[this.learnKey].edu = value
      this.eduShow = false
    },
    eduCancelFn () {
      this.eduShow = false
    },

    educationType2Focus () {
      document.activeElement.blur()
      this.educationType2Show = true
    },
    educationType2ConfirmFn (value, index) {
      this.addForm.educationType2 = value
      this.educationType2Show = false
    },
    educationType2CancelFn () {
      this.educationType2Show = false
    },

    educationType1Focus () {
      document.activeElement.blur()
      this.educationType1Show = true
    },
    educationType1ConfirmFn (value, index) {
      this.addForm.educationType1 = value
      this.educationType1Show = false
    },
    educationType1CancelFn () {
      this.educationType1Show = false
    },

    membersInput (key) {
      this.addForm.members += key;
    },

    membersDelete () {
      this.addForm.members = this.addForm.members + '';
      if (!this.addForm.members) {
        return;
      }
      this.addForm.members = this.addForm.members.substring(0, this.addForm.members.length - 1);
    },

    childrensInput (key) {
      this.addForm.childrens += key;
    },

    childrensDelete () {
      this.addForm.childrens = this.addForm.childrens + '';
      if (!this.addForm.childrens) {
        return;
      }
      this.addForm.childrens = this.addForm.childrens.substring(0, this.addForm.childrens.length - 1);
    },

    marriageStatusFocus () {
      document.activeElement.blur()
      this.marriageStatusShow = true
    },
    marriageStatusConfirmFn (value, index) {
      this.addForm.marriageStatus = value
      this.marriageStatusShow = false
    },
    marriageStatusCancelFn () {
      this.marriageStatusShow = false
    },

    houseTypeFocus () {
      document.activeElement.blur()
      this.houseTypeShow = true
    },
    houseTypeConfirmFn (value, index) {
      this.addForm.houseType = value
      this.houseTypeShow = false
    },
    houseTypeCancelFn () {
      this.houseTypeShow = false
    },

    charactersFocus () {
      document.activeElement.blur()
      this.charactersShow = true
    },

    charactersConfirmFn (value, index) {
      this.addForm.characters = value
      this.charactersShow = false
    },
    charactersCancelFn () {
      this.charactersShow = false
    },

    politicalFaceFocus () {
      document.activeElement.blur()
      this.politicalFaceShow = true
    },

    politicalFaceConfirmFn (value, index) {
      this.addForm.politicalFace = value
      this.politicalFaceShow = false
    },
    politicalFaceCancelFn () {
      this.politicalFaceShow = false
    },


    empTypeFocus () {
      document.activeElement.blur()
      this.empTypeShow = true
    },

    empTypeConfirmFn (value, index) {
      this.addForm.empType = value
      this.empTypeShow = false
    },
    empTypeCancelFn () {
      this.empTypeShow = false
    },


    inductionPostFocus () {
      document.activeElement.blur()
      this.inductionPostShow = true
    },

    inductionPostConfirmFn (value, index) {
      this.addForm.inductionPost = value
      this.inductionPostShow = false
    },
    inductionPostCancelFn () {
      this.inductionPostShow = false
    },


    hobbyFocus () {
      document.activeElement.blur()
      this.hobbyShow = true
    },

    hobbyConfirmFn (value, index) {
      this.addForm.hobby = value
      this.hobbyShow = false
    },
    hobbyCancelFn () {
      this.hobbyShow = false
    },


    weightInput (key) {
      this.addForm.weight += key;
    },

    weightDelete () {
      this.addForm.weight = this.addForm.weight + '';
      if (!this.addForm.weight) {
        return;
      }
      this.addForm.weight = this.addForm.weight.substring(0, this.addForm.weight.length - 1);
    },

    heightInput (key) {
      this.addForm.height += key;
    },

    heightDelete () {
      this.addForm.height = this.addForm.height + '';
      if (!this.addForm.height) {
        return;
      }
      this.addForm.height = this.addForm.height.substring(0, this.addForm.height.length - 1);
    },

    sexFocus () {
      document.activeElement.blur()
      this.sexShow = true
    },
    sexConfirmFn (value, index) {
      this.addForm.sex = value
      this.sexShow = false
    },
    sexCancelFn () {
      this.sexShow = false
    },

    nationFocus () {
      document.activeElement.blur()
      this.nationShow = true
    },
    nationConfirmFn (value, index) {
      this.addForm.nation = value
      this.nationShow = false
    },
    nationCancelFn () {
      this.nationShow = false
    },

    ageInput (key) {
      this.addForm.age += key;
    },

    ageDelete () {
      this.addForm.age = this.addForm.age + '';
      if (!this.addForm.age) {
        return;
      }
      this.addForm.age = this.addForm.age.substring(0, this.addForm.age.length - 1);
    },

    quacardTypeFocus () {
      document.activeElement.blur()
      this.quacardTypeShow = true
    },
    quacardTypeConfirmFn (value, index) {
      this.addForm.quacardType = value
      this.quacardTypeShow = false
    },
    quacardTypeCancelFn () {
      this.quacardTypeShow = false
    },

    technicalTitleFocus () {
      document.activeElement.blur()
      this.technicalTitleShow = true
    },
    technicalTitleConfirmFn (value, index) {
      this.addForm.technicalTitle = value
      this.technicalTitleShow = false
    },
    technicalTitleCancelFn () {
      this.technicalTitleShow = false
    },

    languageFocus () {
      document.activeElement.blur()
      this.languageShow = true
    },
    languageConfirmFn (value, index) {
      this.addForm.languageStatus = value
      this.languageShow = false
    },
    languageCancelFn () {
      this.languageShow = false
    },

    vehicleFocus () {
      document.activeElement.blur()
      this.vehicleShow = true
    },
    vehicleConfirmFn (value, index) {
      this.addForm.vehicle = value
      this.vehicleShow = false
    },
    vehicleCancelFn () {
      this.vehicleShow = false
    },

    birthdayFocus () {
      document.activeElement.blur()
      this.birthdayShow = true
    },
    birthdayChangeFn () { // 值变化是触发
      this.changeDate = this.currentDate // Tue Sep 08 2020 00:00:00 GMT+0800 (中国标准时间)
    },
    birthdayConfirmFn () { // 确定按钮
      this.addForm.birthday = this.timeFormat(this.currentDate);
      this.birthdayShow = false;
    },
    birthdayCancelFn () {
      console.log('关')
      this.birthdayShow = false;
    },


    inductionDateFocus () {
      document.activeElement.blur()
      this.inductionDateShow = true
    },
    inductionDateChangeFn () { // 值变化是触发
      this.changeDate = this.currentDate // Tue Sep 08 2020 00:00:00 GMT+0800 (中国标准时间)
    },
    inductionDateConfirmFn () { // 确定按钮
      this.addForm.inductionDate = this.timeFormat(this.currentDate);
      this.inductionDateShow = false;
    },
    inductionDateCancelFn () {
      console.log('关')
      this.inductionDateShow = false;
    },

    learnendFocus (key) {
      document.activeElement.blur()
      this.learnKey = key
      this.learnendShow = true
    },
    learnendChangeFn () { // 值变化是触发
      this.changeDate = this.currentDate // Tue Sep 08 2020 00:00:00 GMT+0800 (中国标准时间)
    },
    learnendConfirmFn () { // 确定按钮
      this.addForm.h2LearnhistoryList[this.learnKey].enddate = this.timeFormat(this.currentDate);
      this.learnendShow = false;
    },
    learnendCancelFn () {
      console.log('关')
      this.learnendShow = false;
    },



    learnstartFocus (key) {
      document.activeElement.blur()
      this.learnKey = key
      this.learnstartShow = true
    },
    learnstartChangeFn () { // 值变化是触发
      this.changeDate = this.currentDate // Tue Sep 08 2020 00:00:00 GMT+0800 (中国标准时间)
    },
    learnstartConfirmFn () { // 确定按钮
      this.addForm.h2LearnhistoryList[this.learnKey].startdate = this.timeFormat(this.currentDate);
      this.learnstartShow = false;
    },
    learnstartCancelFn () {
      console.log('关')
      this.learnstartShow = false;
    },

    fillPostClick () {
      // alert(this.addForm.filingPost)
      filingPost = filingPost1.join(',');
    },


    timeFormat (time) { // 时间格式化 2019-09-08
      let year = time.getFullYear();
      let month = ("0" + (time.getMonth() + 1)).slice(-2);
      let day = ("0" + time.getDate()).slice(-2);
      return year + "-" + month + "-" + day
    },
    initData () {
      this.addForm.h2LearnhistoryList = [];
      this.addForm.h2WorkhistoryList = [];
    },
    addLearnhistory () {
      this.addForm.h2LearnhistoryList.push({
        schoolName: "",
        startdate: "",
        enddate: "",
        major: "",
        edu: "",
        certificate: ""
      });
    },
    deleteLearnhistory (item, index) {
      this.index = this.addForm.h2LearnhistoryList.indexOf(item);
      console.log(this.index);
      if (this.index == 0) {
        console.log(this.index);
        return;
      }

      if (index !== -1) {
        this.addForm.h2LearnhistoryList.splice(index, 1);
      }
    },
    addWorkhistory () {
      this.addForm.h2WorkhistoryList.push({
        companyname: "",
        startdate: "",
        enddate: "",
        jobtitle: ""
      });
    },
    deleteWorkhistory (item, index) {
      this.index = this.addForm.h2WorkhistoryList.indexOf(item);
      if (index !== -1) {
        this.addForm.h2WorkhistoryList.splice(index, 1);
      }
    },
    submit () {

      var url = window.location.href;             //获取当前url
      console.log(url);

      var dz_url = url.split('#')[0];

      console.log(dz_url);

      if (!this.addForm.busno) {
        this.$toast("请输入海典门店编号!");
        return false
      }

      if (!this.addForm.orgname) {
        this.$toast("请输入海典门店名称!");
        return false
      }

      if (!this.addForm.empName) {
        this.$toast("请输入员工姓名!");
        return false
      }

      //alert(this.addForm.franchise)

      //alert(this.addForm.idCard)
      http.fetchGet('/pd/checkSMSCode?mobile=' + this.addForm.mobile + '&checkcode=' + this.addForm.checkcode).then((data) => {
        if (data.data.msg == 'success') {
          this.$store.dispatch('updateGlobalBusno', this.addForm.busno)
          this.$store.dispatch('updateGlobalEmpname', this.addForm.empName)
          this.$store.dispatch('updateGlobalOrgname', this.addForm.orgname)
          // 在某个方法中
          this.$router.push({ name: 'interviewCreated', params: { busno: this.addForm.busno, empname: this.addForm.empname } });
        } if (data.data.msg == 'fail') {
          this.$toast('验证码不正确')
        } else {
          this.$toast(data.data.msg)
        }
      }).catch(err => {
        console.log(err)
      }
      )



      //this.$router.push('/interviewCreated')


      // this.$dialog.confirm({
      //   title: '标题',
      //   message:
      //     '是否确定提交简历？',
      // })
      //   .then(() => {

      //     http.fetchPost('/H2Interview/create', this.addForm).then((data) => {

      //       if (data.data.msg != 'SUCCESS') {
      //         this.$toast(data.data.msg)
      //       } else {
      //         this.$router.push('/interviewCreated')
      //       }


      //     }).catch(err => {
      //       console.log(err)
      //     }
      //     )
      //   })
      //   .catch(() => {

      //   });
    },
    qureyByBusno () {
      http.fetchGet('/pd/qureyOrgnameByBusno?busno=' + this.addForm.busno).then((data) => {
        if (data.data.msg != 'success') {
          this.$toast(data.data.msg)
        } else {
          console.info(data.data.data.orgname)
          this.addForm.orgname = data.data.data.orgname
        }
      }).catch(err => {
        console.log(err)
      }
      )
    },
    sendSMSCode () {
      http.fetchGet('/pd/sendSMSCode?mobile=' + this.addForm.mobile).then((data) => {
        if (data.data.msg == 'success') {
          this.addForm.empName = data.data.data.empname
          this.$toast('验证码发送成功！请查看手机')
        } else if (data.data.msg == 'fail') {
          this.$toast('没有权限，请联系人力资源部添加')
        } else {
          this.$toast(data.data.msg)
        }


      }).catch(err => {
        console.log(err)
      }
      )
    }

  },
};
</script>


<style scoped>
</style>
